<?php
class Zend_Validate_DateGreaterThan extends Zend_Validate_Abstract
{
 
    const NOT_GREATER = 'notGreaterThan';
 
    protected $_messageTemplates = array(
        self::NOT_GREATER => "'%value%' is not greater than '%min%'"
    );
 
    protected $_messageVariables = array(
        'min' => '_min'
    );
 
    protected $_min;
 
    protected $_inclusive;
     
    protected $_datePart;
 
    public function __construct( Zend_Date $min, $datePart = Zend_Date::TIMESTAMP )
    {
        $this->setMin( $min )
             ->setDatePart( $datePart );
    }
 
    public function getMin()
    {
        return $this->_min;
    }
 
    public function setMin( Zend_Date $min )
    {
        $this->_min = $min;
        return $this;
    }
 
    public function getDatePart()
    {
        return $this->_datePart;
    }
 
    public function setDatePart( $datePart )
    {
        $this->_datePart = $datePart;
        return $this;
    }
 
    public function isValid( $value )
    {
        if( !$value instanceof Zend_Date )
        {
            try
            {
                $value = new Zend_Date( $value );
            }
            catch( Exception $exception )
            {
                require_once 'Zend/Validate/Exception.php';
                throw new Zend_Validate_Exception( $exception->getMessage() );
            }
        }
 
        $this->_setValue( $value );
 
        if( $this->_min->isLater( $value, $this->_datePart ) )
        {
            $this->_error( self::NOT_GREATER );
            return false;
        }
        return true;
    }
 
}